package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.WuliuBean;
import com.lwj.liwanjia.impl.WuliuView;
import com.lwj.liwanjia.model.WuliuModel;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/23.
 */

public class WuliuPresenter {
    private WuliuView wuliuView;
    private WuliuModel wuliuModel;

    public WuliuPresenter(WuliuView wuliuView) {
        this.wuliuView = wuliuView;
        wuliuModel = new WuliuModel();
    }

    public void editWuliu(Map<String, Object> map) {
        if (wuliuView != null) {
            wuliuModel.editWuliu(map, new Subscriber<WuliuBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    wuliuView.showError((Exception) e);
                }

                @Override
                public void onNext(WuliuBean wuliuBean) {
                    wuliuView.editWuliu(wuliuBean);
                }
            });
        }
    }
}
